<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		
		<style>
		/* 下拉按钮样式 */
		.dropbtn {
		    background-color: #4CAF50;
		    color: white;
		    padding: 16px;
		    font-size: 16px;
		    border: none;
		    cursor: pointer;
		}
		
		/* 容器 <div> - 需要定位下拉内容 */
		.dropdown {
		    position: relative;
		    display: inline-block;
		}
		
		/* 下拉内容 (默认隐藏) */
		.dropdown-content {
		    display: none;
		    position: absolute;
		    background-color: #f9f9f9;
		    min-width: 160px;
		    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
			left: 20vw;
			
		}
		
		/* 下拉菜单的链接 */
		.dropdown-content a {
		    color: black;
		    padding: 12px 16px;
		    text-decoration: none;
		    display: block;
			margin-left: 5vw;
		}
		
		/* 鼠标移上去后修改下拉菜单链接颜色 */
		.dropdown-content a:hover {background-color: #f1f1f1}
		
		/* 在鼠标移上去后显示下拉菜单 */
		
		
		/* 当下拉内容显示后修改下拉按钮的背景颜色 */
		.dropdown:hover .dropbtn {
		    background-color: #3e8e41;
		}
		</style>
	
	</head>

	
	<body>
		
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">找回密码</h1>
		</header>
		
		<div class="mui-content">
			<div style="margin-top: 5vh;margin-left: 10vw;width:80vw;margin-right: 10vw;">
				<div id="anniu" class="dropdown" style="width: 100%;">
				  <button type="button" data-loading-icon="mui-spinner mui-spinner-custom" class="dropbtn mui-btn  mui-btn-gray mui-btn-block mui-btn-outlined" >查询账号</button>
				  <div class="dropdown-content" id="liebiao">
				  </div>
				</div>
			
			</div>
			
			<div class="mui-input-row"  style="margin-top: 20vh;">
				<label  style="font-size: 18px;font-weight: 500;">账号</label>
				<input type="text" placeholder=""  id="zhanghao">
			</div>
			
			<button type="button" class="mui-btn   mui-btn-block" style="margin-top: 3vh;background-color: #1AAD19;color: white;" id="quedingdenglu">确定登录</button>
			</div>
			
			
		

           <script src="js/app.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init()
		</script>

		<script type="text/javascript">
			
			var x = 0;
			mui(document.body).on('tap', '.mui-btn', function(e) {
				mui(this).button('loading');
				setTimeout(function() {
					mui(this).button('reset');
				}.bind(this), 2000);
			});
			
			
			document.getElementById("anniu").addEventListener('tap',function(){
				
				if(x==0)
				{
					document.getElementsByClassName('dropdown-content')[0].style.display="block";
					x = 1 ;
				}
				else{
					document.getElementsByClassName('dropdown-content')[0].style.display="none";
					x = 0;
				}
				
			});
			
			mui.plusReady(function () {
				// var page = mui.preload({
				// 	url: 'index.html',
				// 	id: 'index.html' //默认使用当前页面的url作为id
				
				// });
			    
			function dushuju(){
			
				plus.sqlite.openDatabase({
					name: 'shuju',
					path: '_doc/shuju.db',
					success: function(e) {
			
			
					},
					fail: function(e) {
			
					}
				});
			
			
				plus.sqlite.selectSql({
			
					name: 'shuju',
					sql: 'select * from  yonghu',
					success: function(e) {
						console.log(JSON.stringify(e));
			
						var h;

						var  jslu=new Array();
						
                          jslu.length = e.length;
						  
						  for(var  i = 0; i < jslu.length; i++)
						  {
							  jslu[i]=0;
							  
						  };
						  
						   for(  i = 0; i <  e.length; i++)
						  {
						  	for(var  z = 0; z < e.length; z++)
							{
								if(e[i].username == e[z].username)
								 {
									 jslu[i]++;
									 if(jslu[i]!=1){
										 
									 jslu[i]=1;
									 jslu[z]=0;
										 
										 
									 }
		
								 }
							}
						  							  
						  };
						  
						  var html = "";
						  
						for ( i = 0; i < e.length; i++) {
							
							if(jslu[i]==1)
							{
								console.log(i);
								html = html + '<a href="#" >' + e[i].username + '</a>';
							  console.log(html);
							}
						
						};
						document.getElementById('liebiao').innerHTML = html;
			
			
						var list = document.getElementsByTagName('a');
						for (let j = 0; j < list.length; j++) {
			
							list[j].addEventListener('tap', function() {
			                            
								document.getElementById('zhanghao').value = list[j].innerHTML;
								document.getElementById('zhanghao').placeholder = list[j].innerHTML;
			                 
						   document.getElementById('quedingdenglu').addEventListener('tap', function() {
							
								for (let y = 0; y < e.length; y++) {
									
									if (list[j].innerHTML == e[y].username)
									{
										
								console.log(JSON.stringify(e[y])) ;
								app.setUserGlobalInfo(e[y]);
								let w = plus.webview.create("index.html", "index.html");
								plus.webview.show(w);
										
						}
											
						}
										  
					});
			
			
			
			
							})
						}
			
			
			
					},
					fail: function(e) {
						console.log(JSON.stringify(e))
					}
			
				});
			
			}
			
			dushuju();
			
			
			});
			
			
			
			
			
		</script>

	</body>

</html>
